package com.sdemo.common.task;

 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.sdemo.common.globals.Globals;

@Component
@EnableScheduling
public class TestTask {
	
	private static final Logger logger = LoggerFactory.getLogger(TestTask.class);

	
	 @Autowired
	 private Globals globals;
	 
	//@Scheduled(cron = "0 0 1 * * ?")//每天凌晨1点执行
	 
	//@Scheduled(cron="0/10 * * * * ? ")//每10秒执行一次
    public void test(){
        logger.info("TestTask定时任务状态isTaskoff：{}" , globals.isTaskoff());

        long begin = System.currentTimeMillis();

        long end = System.currentTimeMillis();
        logger.info("自动计算xxxx定时任务结束，共耗时：[{}]毫秒",(end-begin));

    }
}
